﻿@page
@model FastEtlWeb.Pages.DicTypeFormModel
@{
    Layout = null;
}
<form id="submitForm" style="margin-top:10px;">
    @Html.HiddenFor(a => Model.info.Id)
    <div class="input-group">
        <div class="input-group-addon input-group-none"><label>名称</label></div>
        @Html.TextBoxFor(a => a.info.Name, new { @class = "form-control", @autocomplete = "off" })
    </div>
</form>
<div class="center">
    <button type="button" class="btn btn-primary center" id="FormBtn">确定</button>
    <button type="button" class="btn btn-primary center" id="DelBtn">删除</button>
    <button type="button" class="btn btn-primary center" id="CloseBtn">关闭</button>
</div>
<script>
     $("#FormBtn").click(function () {
        parent.layer.load(2);
        var reg = new RegExp("info.", "g");
        $.ajax({
            type: "post",
            url: "DicTypeForm?handler=DicTypeForm",
            data: $("#submitForm").serialize().replace(reg, ""),
            success: function (result) {
                parent.layer.closeAll('loading');
                parent.layer.msg(result.msg);
                if (result.success) 
                    $.QueryList("DicType?handler=DicTypeList", "DicTypeForm", "DicTypeContent", "DicTypeTable");
            }
        });
     });

    $("#CloseBtn").click(function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    });

    $("#DelBtn").click(function () {
        parent.layer.load(2);
        var reg = new RegExp("info.", "g");
        $.ajax({
            type: "post",
            url: "DicTypeForm?handler=Del",
            data:  $("#submitForm").serialize().replace(reg, ""),
            success: function (result) {
                parent.layer.closeAll('loading');
                parent.layer.msg(result.msg);
                if (result.success)
                    $.QueryList("DicType?handler=DicTypeList", "DicTypeForm", "DicTypeContent", "DicTypeTable");
            }
        });
     });
</script>